/*----------------------------------------------------------------------------
*         ATMEL Microcontroller Software Support  -  ROUSSET  -
*----------------------------------------------------------------------------
* The software is delivered "AS IS" without warranty or condition of any
* kind, either express, implied or statutory. This includes without
* limitation any warranty or condition with respect to merchantability or
* fitness for any particular purpose, or against the infringements of
* intellectual property rights of others.
*----------------------------------------------------------------------------
* File Name           : Board.h
* Object              : AT91SAM7S Evaluation Board Features Definition File.
*
* Creation            : JPP   16/Jun/2004
* Modifications	      : Steve Weddell  March, 2008
* V 1.0 21/Feb/05 JPP : Define __ramfunc
* V 1.1 21/Feb/05 JPP : add Lib definition
* V 1.2 22/Feb/05 JPP : Add DBGU inline definition
*----------------------------------------------------------------------------
*/
#ifndef Board_h
#define Board_h

#include "AT91SAM7S64.h"
#define __inline static inline
#include "lib_AT91SAM7S64.h"

#define __ramfunc

#define true	-1
#define false	0

/*-------------------------------*/
/* SAM7Board Memories Definition */
/*-------------------------------*/
// The AT91SAM7S256 embeds a 64 Kbyte SRAM bank, and 256 KByte Flash

#define  INT_SARM           0x00200000
#define  INT_SARM_REMAP	    0x00000000

#define  INT_FLASH          0x00000000
#define  INT_FLASH_REMAP    0x01000000

#define  FLASH_PAGE_NB	    512
#define  FLASH_PAGE_LOCK    32
#define  FLASH_PAGE_SIZE    128

/*-----------------*/
/* Leds Definition */
/*-----------------*/
#define LED1        AT91C_PIO_PA16
#define LED2        AT91C_PIO_PA21
#define LED3        AT91C_PIO_PA22
#define LED4        AT91C_PIO_PA23
#define LEDa        AT91C_PIO_PA24
#define LEDb        AT91C_PIO_PA25
#define LEDc        AT91C_PIO_PA26
#define LEDd        AT91C_PIO_PA27
#define LEDe        AT91C_PIO_PA28
#define LEDf        AT91C_PIO_PA29
#define LEDg        AT91C_PIO_PA30
#define LEDdp       AT91C_PIO_PA31

#define NUM_DIGITS 4

#define LED_ALLDIGITS (LED1 | LED2 | LED3 | LED4)
#define LED_ALLSEGS  (LEDa | LEDb | LEDc | LEDd | LEDe | LEDf | LEDg | LEDdp)

#define STATUS_LED_RED AT91C_PIO_PA0
#define STATUS_LED_GREEN AT91C_PIO_PA1

/*--------------------*/
/* Keypad definitions */
/*--------------------*/
#define KEYPAD_NUM_ROWS 4
#define KEYPAD_NUM_COLS 4

#define KEYPAD_COL1 AT91C_PIO_PA3
#define KEYPAD_COL2 AT91C_PIO_PA4
#define KEYPAD_COL3 AT91C_PIO_PA5
#define KEYPAD_COL4 AT91C_PIO_PA6
#define KEYPAD_ROW1 AT91C_PIO_PA7
#define KEYPAD_ROW2 AT91C_PIO_PA8
#define KEYPAD_ROW3 AT91C_PIO_PA9
#define KEYPAD_ROW4 AT91C_PIO_PA10


/*--------------*/
/* Master Clock */
/*--------------*/

#define EXT_OC          18432000   // Exetrnal ocilator MAINCK
#define MCK             47923200   // MCK (PLLRC div by 2)
#define MCKKHz          (MCK/1000) //

#endif /* Board_h */
